<?php

class FActiveRecord extends CActiveRecord {

    protected function beforeSave() {
        parent::beforeSave();

        if ($this->getIsNewRecord()) {
            $this->setAttribute('insert_by', 'anonymous');
            $this->setAttribute('insert_time', date('Y-m-d H:i'));
        }

        $this->setAttribute('update_by', 'anonymous');
        $this->setAttribute('update_time', date('Y-m-d H:i'));

        return true;
    }

}